<template>
  <div class="chart-card">
    <div class="title">{{ title }}</div>
    <div class="echart">
      <slot />
    </div>
  </div>
</template>

<script setup lang="ts">
  interface IProps {
    title?: string
  }
  withDefaults(defineProps<IProps>(), {
    title: '默认标题'
  })
</script>

<style lang="scss" scoped>
  .chart-card {
    background-color: #fff;
    height: 100%;
    padding: 5px 10px;
    display: flex;
    flex-direction: column;
    .title {
      height: 15px;
      padding-bottom: 10px;
      border-bottom: 1px solid #e6e5e6;
    }
    .echart {
      flex: 1;
    }
  }
</style>
